package com.sc.VenusQueryBeta.ui.activites.details;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.AppBarLayout;
import android.view.Gravity;
import android.view.View;

import com.hengjun.kingstar.sdk.base.BasePresenter;
import com.hengjun.kingstar.sdk.utils.DisplayUtils;
import com.hengjun.kingstar.sdk.utils.HtmlUtils;
import com.hengjun.kingstar.sdk.utils.LogUtil;
import com.hengjun.kingstar.sdk.utils.LogUtils;
import com.hengjun.kingstar.sdk.utils.StatusBarUtils;
import com.sc.VenusQueryBeta.R;
import com.sc.VenusQueryBeta.api.Host;
import com.sc.VenusQueryBeta.constant.Constants;
import com.sc.VenusQueryBeta.contract.detail.ZhiXunDetailContract;
import com.sc.VenusQueryBeta.presenter.detail.ZhiXunDetailPresenter;

/**
 * 咨询详情页面
 */
public class ZiXunDetailsActivity extends  BaseWebViewLoadActivity< ZhiXunDetailContract
        . ZhiXunDetailPresenter> implements  ZhiXunDetailContract.IZiXunDetailDetailView {


    private String detail;

    @Override
    protected void initView(Bundle savedInstanceState) {
        super.initView(savedInstanceState);
        AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) appBar.getChildAt(0)
                .getLayoutParams();
        // 控件的高强制设成56dp+状态栏高度，重新定义AppBarLayout的高度
        params.height = DisplayUtils.dp2px(56) + StatusBarUtils.getStatusBarHeight
                (mContext);
        tvDetailTitle.setGravity(Gravity.CENTER_VERTICAL);
//        showProgressDialog("請稍等..");
        LogUtils.e("loadDetail555");
//        mPresenter.loadDailyDetail("");
//        toolbar.setTitle(getString(R.string.detail_msg));
        flNetView.setVisibility(View.GONE);
        nswvDetailContent.loadDataWithBaseURL(Host.HostImg+"/", detail, HtmlUtils.MIME_TYPE, HtmlUtils.ENCODING,null);
        nswvDetailContent.getSettings().setDomStorageEnabled(true);
    }

    @Override
    protected void initData() {
        super.initData();
        Bundle extras = getIntent().getExtras();
        if (extras != null) {
            detail = extras.getString(Constants.BANNER_DETAIL);
//            flNetView.setVisibility(View.GONE);
//            nswvDetailContent.loadDataWithBaseURL(Host.HostImg+"/", detail, HtmlUtils.MIME_TYPE, HtmlUtils.ENCODING,null);
//            nswvDetailContent.loadData(detail, HtmlUtils.MIME_TYPE, HtmlUtils.ENCODING);

        }
    }

    @Override
    protected void loadDetail() {
//        showProgressDialog("請稍等..");
//        LogUtils.e("loadDetail555");
//        mPresenter.loadDailyDetail("");
    }

    @Override
    protected String getToolbarTitle() {
        LogUtil.e("getToolbarTitle走了这里了吗");
//        return getString(R.string.detail_msg);
        return null;
    }
    @NonNull
    @Override
    public BasePresenter initPresenter() {
        return ZhiXunDetailPresenter.newInstance();
    }

    @Override
    public void showDailyDetail(Object bean) {
//            hideProgressDialog();
//        flNetView.setVisibility(View.GONE);
//        nswvDetailContent.loadDataWithBaseURL(Host.HostImg+"/", detail, HtmlUtils.MIME_TYPE, HtmlUtils.ENCODING,null);
//        nswvDetailContent.getSettings().setDomStorageEnabled(true);
//        toolbar.setTitle("詳細咨詢");
//        toolbar.get

    }
}
